package cn.shopthrive.merchants.wxapi;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.tencent.mm.opensdk.modelbase.BaseReq;
import com.tencent.mm.opensdk.modelbase.BaseResp;
import com.tencent.mm.opensdk.openapi.IWXAPIEventHandler;

import cn.shopthrive.merchants.WeChatHelper;

public class WXEntryActivity extends Activity implements IWXAPIEventHandler {
  private static final String TAG = "WXEntryActivity";

  @Override
  protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    WeChatHelper.handleIntent(this, getIntent(), this);
  }

  @Override
  protected void onNewIntent(Intent intent) {
    super.onNewIntent(intent);
    setIntent(intent);
    WeChatHelper.handleIntent(this, intent, this);
  }

  @Override
  public void onReq(BaseReq req) {
    finish();
  }

  @Override
  public void onResp(BaseResp resp) {
    WeChatHelper.broadcastResponse(this, resp);
    finish();
  }
}
